package com.bjpowernode.crm.settings.service.impl;

import cn.hutool.crypto.digest.DigestUtil;
import com.bjpowernode.crm.settings.domain.User;
import com.bjpowernode.crm.settings.mapper.UserMapper;
import com.bjpowernode.crm.settings.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public User login(String loginAct, String loginPwd) {
        //密码使用MD5加密
        String md5Hex = DigestUtil.md5Hex(loginPwd, "UTF-8");
        //混淆密码
        String confusionPwd = "jkh7s9f8c9" + md5Hex + "ggbong";
        //MD5加盐
        String saltPwd = DigestUtil.md5Hex(confusionPwd, "UTF-8");
        //根据账号和密码查询用户信息
        return userMapper.selectByLoginActAndPwd(loginAct,saltPwd);
    }
}
